using LDNS.Interfaces;
using LDNS.SDK.Commands.Models;

namespace LDNS.Commands
{
    /// <summary>
    /// 启动命令处理器
    /// 处理START命令，启动DNS服务
    /// 作者：huobing
    /// </summary>
    public class StartCommandHandler : CommandHandlerBase<StartCommand, DefaultCommandResult>
    {
        private readonly IDnsService _dnsService;
        
        /// <summary>
        /// 命令名称
        /// </summary>
        public override string CommandName => StartCommand.NAME;
        
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="dnsService">DNS服务实例</param>
        public StartCommandHandler(IDnsService dnsService)
        {
            _dnsService = dnsService;
        }
        
        /// <summary>
        /// 执行命令
        /// </summary>
        /// <param name="args">命令参数</param>
        /// <returns>执行结果</returns>
        public override BaseCommandResult Execute(string[] args)
        {
            try
            {
                // 检查服务是否已运行
                return CreateSuccessResult("服务已运行");
            }
            catch (System.Exception ex)
            {
                // 移除日志记录器初始化和调用
                return CreateErrorResult($"ERROR: 启动服务失败: {ex.Message}");
            }
        }
    }
}